#!/bin/bash

TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
echo "$TIMESTAMP: Received event: $1 $2 $3 $4"

case "$2" in
    INTERFACE-DISABLED)
        # 处理 wlan0 down 的逻辑
        echo "wlan0 down"
#	hostapd_cli -i wlan0 disable
	ifconfig wlan0 up
        ;;
    INTERFACE-ENABLED)
        # 处理 wlan0 up 的逻辑
        echo "wlan0 up"
        hostapd_cli -i wlan0 disable
	hostapd_cli -i wlan0 enable
        ;;
esac
